package datastructure.tree;

/**
 * @Description: 红黑树节点
 * @Author Ammar
 * @Create 2023/4/17 07:13
 */
public class RedBlackNode<E> extends TreeNode<E> {
    public static final boolean RED = false;
    public static final boolean BLACK = true;
    public boolean color = RED;

    public RedBlackNode(E val, TreeNode<E> parent) {
        super(val, parent);
    }

    @Override
    public String toString() {
        String parentStr = "null";
        if (parent != null) {
            parentStr = parent.val.toString();
        }
        return val + "_p(" + parentStr + ")_c(" + (color == RED ? "R" : "B") + ")";
    }
}
